\(\int \cot (e+f x) (a+b \sec ^2(e+f x)) \, dx\) [314]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 28 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {b \log (\cos (e+f x))}{f}+\frac {(a+b) \log (\sin (e+f x))}{f} \]

[Out]

-b*ln(cos(f*x+e))/f+(a+b)*ln(sin(f*x+e))/f

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4223, 457, 78} \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {(a+b) \log (\sin (e+f x))}{f}-\frac {b \log (\cos (e+f x))}{f} \]

[In]

Int[Cot[e + f*x]*(a + b*Sec[e + f*x]^2),x]

[Out]

-((b*Log[Cos[e + f*x]])/f) + ((a + b)*Log[Sin[e + f*x]])/f

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {b+a x^2}{x \left (1-x^2\right )} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {\text {Subst}\left (\int \frac {b+a x}{(1-x) x} \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {\text {Subst}\left (\int \left (\frac {-a-b}{-1+x}+\frac {b}{x}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {b \log (\cos (e+f x))}{f}+\frac {(a+b) \log (\sin (e+f x))}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.79 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {a \log (\cos (e+f x))}{f}-\frac {b \log (\cos (e+f x))}{f}+\frac {b \log (\sin (e+f x))}{f}+\frac {a \log (\tan (e+f x))}{f} \]

[In]

Integrate[Cot[e + f*x]*(a + b*Sec[e + f*x]^2),x]

[Out]

(a*Log[Cos[e + f*x]])/f - (b*Log[Cos[e + f*x]])/f + (b*Log[Sin[e + f*x]])/f + (a*Log[Tan[e + f*x]])/f

Maple [A] (verified)

Time = 0.33 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.86

method result size
derivativedivides \(\frac {a \ln \left (\sin \left (f x +e \right )\right )+b \ln \left (\tan \left (f x +e \right )\right )}{f}\) \(24\)
default \(\frac {a \ln \left (\sin \left (f x +e \right )\right )+b \ln \left (\tan \left (f x +e \right )\right )}{f}\) \(24\)
risch \(-i a x -\frac {2 i a e}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) a}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) b}{f}-\frac {b \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f}\) \(67\)

[In]

int(cot(f*x+e)*(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(a*ln(sin(f*x+e))+b*ln(tan(f*x+e)))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.25 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {b \log \left (\cos \left (f x + e\right )^{2}\right ) - {\left (a + b\right )} \log \left (-\frac {1}{4} \, \cos \left (f x + e\right )^{2} + \frac {1}{4}\right )}{2 \, f} \]

[In]

integrate(cot(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

-1/2*(b*log(cos(f*x + e)^2) - (a + b)*log(-1/4*cos(f*x + e)^2 + 1/4))/f

Sympy [F]

\[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right ) \cot {\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)*(a+b*sec(f*x+e)**2),x)

[Out]

Integral((a + b*sec(e + f*x)**2)*cot(e + f*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.18 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {b \log \left (\sin \left (f x + e\right )^{2} - 1\right ) - {\left (a + b\right )} \log \left (\sin \left (f x + e\right )^{2}\right )}{2 \, f} \]

[In]

integrate(cot(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/2*(b*log(sin(f*x + e)^2 - 1) - (a + b)*log(sin(f*x + e)^2))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 98 vs. \(2 (28) = 56\).

Time = 0.28 (sec) , antiderivative size = 98, normalized size of antiderivative = 3.50 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {a \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 2 \right |}\right ) + b \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} - 2 \right |}\right )}{2 \, f} \]

[In]

integrate(cot(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="giac")

[Out]

-1/2*(a*log(abs(-(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 2)) + b*log(a
bs(-(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - (cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 2)))/f

Mupad [B] (verification not implemented)

Time = 19.68 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.14 \[ \int \cot (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a+b\right )}{f}-\frac {a\,\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,f} \]

[In]

int(cot(e + f*x)*(a + b/cos(e + f*x)^2),x)

[Out]

(log(tan(e + f*x))*(a + b))/f - (a*log(tan(e + f*x)^2 + 1))/(2*f)